import { defineComponent, h } from 'vue'
import { ElOption } from 'element-plus'

export default defineComponent({
  components: {
    ElOption
  },
  props: {
    label: {
      type: [String, Number, Boolean, Object],
      default: ''
    },
    value: {
      type: [String, Number, Boolean, Object, Array],
      default: undefined
    },
    disabled: {
      type: Boolean,
      default: false
    }
  },
  setup(props, { slots, attrs }) {
    // 使用render函数渲染组件
    return () => {
      // 使用类型断言解决类型不匹配问题
      const elOptionProps = {
        ...(attrs as any),
        label: props.label,
        value: props.value,
        disabled: props.disabled
      }
      return h(ElOption, elOptionProps as any, {
        default: slots.default
      })
    }
  }
})